home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3905 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to give functions as parameters?
  5. Date: Wed, 31 Jan 96 19:13:32 GMT
  6. Organization: none
  7. Message-ID: <823115612snz@genesis.demon.co.uk>
  8. References: <Pine.SUN.3.91N2x.960130222756.11581A-100000@yellow59.nada.kth.se> <310F787E.7B14@cmt.lpr.mail.carel.fi>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <310F787E.7B14@cmt.lpr.mail.carel.fi>
  15.            aril@cmt.lpr.mail.carel.fi "Ari Lukumies" writes:
  16.  
  17. >Per Steneskog wrote:
  18. >> 
  19. >> I have a little problem, I dont know how to send a fuction,
  20. >> as a parameter to another function..
  21. >> 
  22. >> #include <stdio.h>
  23. >> 
  24. >> void
  25. >> do_it(void (*it)())
  26. >
  27. >You are expecting a pointer to a function returning void...
  28. >
  29. >> {
  30. >>   ((*(it))());
  31. >
  32. >Too much to type, just use
  33. >        (*it)();
  34.  
  35. That works but you can also write it as:
  36.  
  37.          it();
  38.  
  39. -- 
  40. -----------------------------------------
  41. Lawrence Kirby | fred@genesis.demon.co.uk
  42. Wilts, England | 70734.126@compuserve.com
  43. -----------------------------------------
  44.